package cn.tips.dmp.biz.talent.wxApplet.controller;

import cn.tips.dmp.biz.talent.wxApplet.dto.WxCheckUserDTO;
import cn.tips.dmp.biz.talent.wxApplet.dto.WxCheckUserParamsDTO;
import cn.tips.dmp.biz.talent.wxApplet.entity.WxCheckUserPO;
import cn.tips.dmp.biz.talent.wxApplet.service.WxCheckUserService;
import cn.tips.dmp.biz.talent.wxApplet.service.WxWebService;
import cn.tips.dmp.supports.result.ApiResultDTO;
import cn.tips.dmp.supports.result.ApiResultGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

/**
 * @author pkb
 */
@RestController
@RequestMapping("/tipsApi/wechatManage")
public class WxManageController {

	@Autowired
	WxWebService wxWebService;

	@Autowired
	WxCheckUserService wxCheckUserService;


	/**
	 * 小程序专家待审核列表查询
	 * @return
	 */
	@PostMapping("/readAllCheckUserByPage")
	public ApiResultDTO readAllCheckUserByPage(@RequestBody WxCheckUserParamsDTO dto) {
		ApiResultDTO apiResultDto;
		try {
			Page<WxCheckUserPO> pagePos = wxCheckUserService.readAllByPage(dto.getSearchDto(), dto.getPageDto(), dto.getSortDto());

			apiResultDto = ApiResultGenerator.create("0", "分页数据获取成功!", pagePos);
		} catch (Exception e) {
			apiResultDto = ApiResultGenerator.create("-1", "分页数据获取失败!");
		}
		return apiResultDto;
	}

	/**
	 * 审核
	 * @return
	 */
	@PostMapping("/confirmStatusForWxCheckUser")
	public ApiResultDTO readAllCheckUserByPage(@RequestBody WxCheckUserDTO dto) {
		ApiResultDTO apiResultDto;
		try {
			apiResultDto = ApiResultGenerator.create("0", "审核成功!");
		} catch (Exception e) {
			apiResultDto = ApiResultGenerator.create("-1", "审核失败!");
		}
		return apiResultDto;
	}
}
